<script setup lang="ts">
import { ref } from 'vue'
import NavBar from '@/components/NavBar.vue'
//约见记录
import Appointment from '@/pages/my/components/Appointment.vue'
//我的红娘
import Matchmaker from '@/pages/my/components/Matchmaker.vue'
//请求用户信息的方法
import { matchmaker } from '@/services/my/MyMatchmaker/matchmaker'
import { onLoad } from '@dcloudio/uni-app'

import Customer from '@/static/My/Customer.png'
// import giftIcon from '@/static/My/gift.png'

// 获取到用户的ID
const userID = uni.getStorageSync('userInfo').id

const navList = ['我的红娘', '约见记录']
const current = ref(0)
const obj = ref({})

// 获取红娘信息
const getMatchmaker = async () => {
  const data: any = await matchmaker(userID)
  obj.value = data?.data?.result
}
onLoad(() => {
  getMatchmaker()
})
</script>

<template>
  <view class="navbar">
    <NavBar
    :navList="navList"
    @change="
      (index:any) => {
        current = index
      }
    "
    />
    <image :src="Customer"></image>
  </view>
  <view v-if="current === 0">
    <Matchmaker :obj="(obj as any)" />
  </view>
  <view v-show="current === 1">
    <Appointment />
  </view>
</template>

<style lang="scss" scoped>
  .navbar{
    display: flex;
    width: 100vw;
    justify-content: space-between;
    align-items: center;
    padding:0 5%;
    box-sizing: border-box;
    image{
      height: 2rem;
      width: 2rem;
    }
  }
</style>
